<#import "../macro/components.ftl" as components/>
<#include "../macro/layout_default.ftl"/>

<@head>
<link rel="stylesheet" href="/misc/app/css/product_list.css"/>

</@head>

<@body>
<script src="/misc/app/js/activity_prize.js"></script>

</@body>

<@layout_default>



<div class="box">
  <!-- Nav tabs -->
  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation"><a href="/activity?activityId=${activityId}">活动详情</a></li>
    <li role="presentation" class="active"><a href="#profile" aria-controls="profile" role="tab">中奖规则</a></li>
    <li role="presentation"><a href="/activity/getActivityAbstract?activityId=${activityId}">活动规则</a></li>
  </ul>

  <div class="tab-content">
    <div role="tabpanel" class="tab-pane active" id="profile">
      <input type="hidden" id="activityId" value="${activityId}"/><!--活动id-->
      <input type="hidden" id="actBaseNub" value="${actBaseNub?c}"/><!--参奖基数-->

      <!-------------------中奖规则列表 start-------------------->

      <div class="box-header with-border">
        <span class="pull-right text-muted" id="header_span">共 ${activityPrizeList.resultTotal} 条记录</span>
      </div>
      <!-- /.box-header -->
      <div class="box-body">
        <table class="table table-striped table-hover">
          <tr>
            <th>ID</th>
            <th>奖品等级</th>
            <th>奖品名称</th>
            <th>奖品类型</th>
            <th>奖品价格</th>
            <th>次数限制</th>
            <th>投放数量</th>
            <th>中奖比例</th>
            <th>中奖限制数量</th>
            <th>是否需要关注公众号领取</th>
            <th>是否需要输入手机号码</th>
            <th>操作</th>
          </tr>
          <#if activityPrizeList?exists>
            <#list activityPrizeList.result as item>
              <tr>
                <td>${item.id}</td>
                <td>${item.gradeName!}</td>
                <td>${item.prizeName!}</td>
                <td>
                  <#if item.prizeType?exists><#if item.prizeType==1>红包<#elseif item.prizeType==2>实物<#else>
                    优惠券</#if></#if>
                </td>
                <td>${item.prizePrice?string("0.00")}</td>
                <td>${item.sameWinningLimitTimes}</td>
                <td>${item.nub}</td>
                <td>${item.odds?string("0.00")}%</td>
                <td>${item.maxWinnngTimes}</td>
                <td>
                  <#if item.isAttention?exists>
                    <#if item.isAttention==1>是<#else>否</#if>
                  <#else>是
                  </#if>
                </td>
                <td>
                  <#if item.isInput?exists>
                    <#if item.isInput==1>是<#else>否</#if>
                  <#else>是
                  </#if>
                </td>
                <td>
                  <button type="button" class="btn btn-default btn-xs" name="btn_delete_activityPrize"
                          data-activityprize-id="${item.id}">删除
                  </button>
                </td>
              </tr>
            </#list>
          </#if>
        </table>
      </div>
      <!-- /.box-body -->

      <div class="box-footer text-center">
        <@components.pagination "${activityPrizeList.rquesturl}&page=$page",activityPrizeList.page,activityPrizeList.pageTotal/>
      </div>

      <!-------------------中奖规则列表 end------------------------>
      <hr style="border-top-width: 10px;"/>
      <!---------=============中奖规则编辑 start==========---------->
      <div name="md_add_activity_prize">
        <div class="box-header with-border"></div>
        <div class="box-body">
          <form class="form-horizontal" name="form_new_activity_prize">
            <div class="form-group">
              <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 奖品等级</label>
              <div class="col-sm-3">
                <select class="form-control" id="gradeName">
                  <option value="">请选择奖品等级</option>
                  <option value="0">特等奖</option>
                  <option value="1">一等奖</option>
                  <option value="2">二等奖</option>
                  <option value="3">三等奖</option>
                  <option value="9">普通奖</option>
                </select>
              </div>


              <div class="col-sm-5" style="vertical-align:middle;">
                <input type="checkbox" value="自定义" name="grandName_chk" id="chk_custom"/>自定义
                <input type="text" id="grandName_custom" disabled='disabled' style="height:35px;width:280px;" maxlength="100" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 奖品名称</label>
              <div class="col-sm-10">
                <select class="form-control" id="prize" name="prizeId">
                  <option value="">请选择奖品名称</option>
                </select>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">奖品类型</label>
              <div class="col-sm-10" style="padding-top:7.5px;">
                <span id="prizeType"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label">奖品价格</label>
              <div class="col-sm-10" style="padding-top:7.5px;">
                <span id="prizePrice" name="price"></span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 同一用户中奖次数限制</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="同一用户中奖次数，0为不限制" name="sameWinningLimitTimes" maxlength="10" />
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label" name="namelabel"><strong
                  class="text-red bold">*</strong>投放数量</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" style="width:250px;display:inline;" placeholder="投放数量必须小于等于参奖基数" name="nub" id="nub" maxlength="10" /><span> / 中奖比例</span>
                <input type="hidden" class="" placeholder="中奖比例" name="odds" id="odds"
                       disabled='disabled'/><span class="oddsNum"></span>
                      <span style="padding-left:10px;color: #999;">(中奖比例=投放数量/参奖基数，自动计算)</span>
              </div>
            </div>
            <div class="form-group">
              <label class="col-sm-2 control-label"><strong class="text-red bold">*</strong> 最大中奖限制数量</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="限制奖品总投放数量" name="maxWinnngTimes" maxlength="10" />
              </div>
            </div>
            <div class="form-group hide" id="div_attention">
                <label class="col-sm-2 control-label" id="isAttention"><strong class="text-red bold">*</strong>是否需要关注公众号领取</label>
                <div class="col-sm-5" style="padding-top:7px;">
                    <input type="radio" name="isAttention" class="isAttention" id="radio_yes" value="1"  checked/>是&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="isAttention" class="isAttention" id="radio_no" value="0" />否
                </div>
            </div>
            
            <div class="form-group " id="div_Input">
                <label class="col-sm-2 control-label" id="isInput"><strong class="text-red bold">*</strong>是否需要输入手机号码</label>
                <div class="col-sm-5" style="padding-top:7px;">
                    <input type="radio" name="isInput" class="isAttention" id="radio_yes" value="1"  checked/>是&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="radio" name="isInput" class="isAttention" id="radio_no" value="0" />否
                </div>
            </div>
            
          </form>
        </div>
        <div class="box-footer text-center">
          <button type="button" class="btn btn-default" name="btn_cancel_new_activity_prize">取消</button>
          <button type="button" class="btn btn-primary" name="btn_save_new_activity_prize">保存</button>
        </div>
      </div>
      <!-------------中奖规则编辑 end---------------->


    </div>
  </div>


</div>


</@layout_default>